-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/edit task screen #63
Conversation
<View style={{ flex: 1, position: 'relative' }}> | ||
<View style={{ position: 'absolute', top: '10%', left: 5, right: 5 }}> | ||
<PopupModal isVisible={modalVisible} setVisible={setModalVisible}> | ||
<ActivityIndicator size="large" /> | ||
<Text>Adding Task...</Text> | ||
</PopupModal> | ||
<Text | ||
style={{ | ||
color: 'black', | ||
fontSize: 24, | ||
fontWeight: 'bold', | ||
fontFamily: 'Inter' | ||
}} | ||
> | ||
Task Details | ||
</Text> | ||
|
||
<View | ||
style={{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance all of this style stuff can quickly be turned into tailwind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See most recent commit (literally just fed it to GPT). Can you check out the mutations? Anything u see that needs changes there?
export const addNewTaskMutation = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
const { mutate: addTaskMutation } = useMutation({ | ||
mutationFn: (newTask: Task) => addNewTask(newTask), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries('filteredTaskList'); | ||
}, | ||
onError: (err) => { | ||
console.error('ERROR: Failed to Add Task. Code:', err); | ||
} | ||
}); | ||
|
||
return addTaskMutation; | ||
}; | ||
|
||
export const editTaskMutation = () => { | ||
const queryClient = useQueryClient(); | ||
|
||
const { mutate: editTaskMutation } = useMutation({ | ||
mutationFn: ({ | ||
taskId, | ||
updatedTask | ||
}: { | ||
taskId: string; | ||
updatedTask: Task; | ||
}) => editTask(taskId, updatedTask), | ||
onSuccess: () => { | ||
queryClient.invalidateQueries('filteredTaskList'); | ||
}, | ||
onError: (err) => { | ||
console.error('ERROR: Failed to Edit Task. Code:', err); | ||
} | ||
}); | ||
|
||
return editTaskMutation; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimistic updates maybe?
Description
Link to Ticket
Added mutations for new tasks and updating tasks. Also added bones of add new task details screen (currently disconnected)
How Has This Been Tested?
No unit tests, but basically copies structure from medication mutations.
Checklist